ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
freemaster_appcmd.c File Reference

FreeMASTER Application Commands implementation. More...

#include "freemaster.h"
#include "freemaster_private.h"
#include "freemaster_protocol.h"

Functions

void FMSTR_InitAppCmds (void)
 Initialize app.cmds interface.
FMSTR_BPTR FMSTR_StoreAppCmd (FMSTR_BPTR pMessageIO)
 Handling SANDAPPCMD command.
FMSTR_BPTR FMSTR_GetAppCmdStatus (FMSTR_BPTR pMessageIO)
 Handling GETAPPCMDSTS command.
FMSTR_BPTR FMSTR_GetAppCmdRespData (FMSTR_BPTR pMessageIO)
 Handling GETAPPCMDDATA command.
void FMSTR_AppCmdAck (FMSTR_APPCMD_RESULT nResultCode)
 API: Mark the application command is processed by the application.
void FMSTR_AppCmdSetResponseData (FMSTR_ADDR nResultDataAddr, FMSTR_SIZE nResultDataLen)
 API: Mark the application command is processed by the application.
FMSTR_APPCMD_CODE FMSTR_GetAppCmd (void)
 API: Fetch the application command code if one is ready for processing.
FMSTR_APPCMD_PDATA FMSTR_GetAppCmdData (FMSTR_SIZE *pDataLen)
 API: Get a pointer to application command data.
FMSTR_BOOL FMSTR_RegisterAppCmdCall (FMSTR_APPCMD_CODE nAppCmdCode, FMSTR_PAPPCMDFUNC pCallbackFunc)
 API: Register or unregister app.cmd callback handler.

Detailed Description

FreeMASTER Application Commands implementation.

Version:
1.0.13.0
Date:
Aug-3-2011

Function Documentation

void FMSTR_AppCmdAck ( FMSTR_APPCMD_RESULT  nResultCode)

API: Mark the application command is processed by the application.

Parameters:
nResultCode- the result code which is returned to a host
void FMSTR_AppCmdSetResponseData ( FMSTR_ADDR  nResultDataAddr,
FMSTR_SIZE  nResultDataLen 
)

API: Mark the application command is processed by the application.

Parameters:
pResultDataAddr- address of data we want to return to the PC
nResultDataLen- length of return data
FMSTR_APPCMD_CODE FMSTR_GetAppCmd ( void  )

API: Fetch the application command code if one is ready for processing.

Returns:
A command code stored in the application cmd buffer. The return value is FMSTR_APPCMDRESULT_NOCMD if there is no new command since the last call to FMSTR_AppCmdAck
FMSTR_APPCMD_PDATA FMSTR_GetAppCmdData ( FMSTR_SIZE *  pDataLen)

API: Get a pointer to application command data.

Parameters:
pDataLen- A pointer to variable which receives the data length
Returns:
Pointer to the "application command" data
FMSTR_BPTR FMSTR_GetAppCmdRespData ( FMSTR_BPTR  pMessageIO)

Handling GETAPPCMDDATA command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_GetAppCmdStatus ( FMSTR_BPTR  pMessageIO)

Handling GETAPPCMDSTS command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
Note:
The callback-registerred commands are processed at the moment the PC tries to get the result for the first time. At this moment, we are sure the PC already got the command delivery packet acknowledged.
FMSTR_BOOL FMSTR_RegisterAppCmdCall ( FMSTR_APPCMD_CODE  nAppCmdCode,
FMSTR_PAPPCMDFUNC  pCallbackFunc 
)

API: Register or unregister app.cmd callback handler.

Parameters:
nAppCmdCode- App.command ID
pCallbackFunc- Pointer to handler function (NULL to unregister)
Returns:
Non-zero if successfull, zero if maximum callbacks already set
FMSTR_BPTR FMSTR_StoreAppCmd ( FMSTR_BPTR  pMessageIO)

Handling SANDAPPCMD command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)